/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DBBrowser.java
 *
 * Created on 2008-12-09, 14:09:43
 */

package DBBrowser_pack;

import browser.Pomoc;
import browser.NewTable;
import browser.SQLConsole;
import browser.DataFrame;
import browser.AddSchema;
import java.beans.*;
import javax.swing.JOptionPane;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.tree.*;

/**
 *
 * @author Dom
 */
public class DBBrowser_Kopia extends javax.swing.JPanel implements java.io.Serializable{

    /** Creates new form DBBrowser */
    public DBBrowser_Kopia() {
        initComponents();
   jTree1.setVisible(false);
   jPopupMenu1.setLabel("Opcje");
   flaga=false;
       try{ 
        
        // Get bean information via Introspection
        BeanInfo info = Introspector.getBeanInfo( DBBrowser_Kopia.class );
        
        // Display properties of a bean
        for ( PropertyDescriptor pd : info.getPropertyDescriptors() ){
            System.out.println( "Field of SimpleBean = " + pd.getName() );
        }
        
        // Display methods of a bean
        for ( MethodDescriptor md : info.getMethodDescriptors() ){
            System.out.println( "Methods of SimpleBean = " + md.getName() );
        }
        
    }
       catch(IntrospectionException e){
           
       }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jPopupMenu2 = new javax.swing.JPopupMenu();
        jMenuItem4 = new javax.swing.JMenuItem();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTree1 = new javax.swing.JTree();
        dBLogin1 = new DBLogin();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jButton6 = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();

        jMenuItem6.setText("Dodaj tabele");
        jPopupMenu1.add(jMenuItem6);

        jMenuItem5.setText("Dodaj Schemat");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItem5);

        jMenuItem1.setText("Odśwież");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItem1);

        jMenuItem2.setText("Usuń");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItem2);

        jMenuItem3.setText("Pomoc");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItem3);

        jMenu1.setText("Dodaj");
        jPopupMenu1.add(jMenu1);

        jMenuItem4.setText("Pokarz/Ukryj panel logowania");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jPopupMenu2.add(jMenuItem4);

        setFont(new java.awt.Font("Tahoma", 0, 12));
        setPreferredSize(new java.awt.Dimension(643, 373));
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
        });

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/DBBrowser/database_add_48.png"))); // NOI18N
        jButton1.setToolTipText("Połącz z bazą danych");
        jButton1.setBorder(null);
        jButton1.setBorderPainted(false);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/DBBrowser/table_green_48.png"))); // NOI18N
        jButton2.setToolTipText("Wyświetl zawartość zaznaczonego obiektu");
        jButton2.setBorder(null);
        jButton2.setBorderPainted(false);
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/DBBrowser/database_remove_48.png"))); // NOI18N
        jButton3.setToolTipText("Rozłącz z bazą danych");
        jButton3.setBorder(null);
        jButton3.setBorderPainted(false);
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/DBBrowser/app_48.png"))); // NOI18N
        jButton4.setToolTipText("Otwórz okno interaktywnego SQL'a");
        jButton4.setBorder(null);
        jButton4.setBorderPainted(false);
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/DBBrowser/navigate_48.png"))); // NOI18N
        jButton5.setToolTipText("Otwórz kreator tabel");
        jButton5.setBorder(null);
        jButton5.setBorderPainted(false);
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jTree1.setModel(treemodel);
        jTree1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTree1MouseClicked(evt);
            }
        });
        jTree1.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
            public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
                jTree1ValueChanged(evt);
            }
        });
        jScrollPane2.setViewportView(jTree1);

        jLabel1.setText("                   ");

        jLabel2.setText("                       ");

        jLabel3.setText("                   ");

        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/DBBrowser/designfloat_48.png"))); // NOI18N
        jButton6.setToolTipText("Pomoc");
        jButton6.setBorder(null);
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton3))
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(jButton6)
                                .addGap(23, 23, 23))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                                .addContainerGap())))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(dBLogin1, javax.swing.GroupLayout.DEFAULT_SIZE, 623, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addComponent(dBLogin1, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(53, 53, 53)
                        .addComponent(jButton6, javax.swing.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed

        okno();
    }//GEN-LAST:event_jButton2ActionPerformed
public void setLogin(String login){
    dBLogin1.setLogin(login);
}
public void setLoginVisibile(boolean flag){
    dBLogin1.setVisible(flag);
}
public void setResizable(boolean flag){
  //  this.set(flag);

}
public String getLogin(){
  return  dBLogin1.getLogin();
}
public void setAdres(String adres){
    dBLogin1.setAdres(adres);
}
public String getAdres(){
  return  dBLogin1.getAdres();
}
public void setPort(String port){
    dBLogin1.setPort(port);
}
public String getPort(){
  return  dBLogin1.getPort();
}
 public void setBaza(String Baza){
    dBLogin1.setBaza(Baza);
}
public String getBaza(){
  return  dBLogin1.getBaza();
}
public void setPassword(String password){
    dBLogin1.setPassword(password);
}
public String getPassword(){
  return  dBLogin1.getPassword();
}
public void setLoginColor(java.awt.Color c){
    dBLogin1.setBackground(c);
}
public java.awt.Color getLoginColor(){
    return dBLogin1.getBackground();
}
public void setTextBg(java.awt.Color c){
    dBLogin1.setTextFieldsBg(c);
    jList1.setBackground(c);
}
public java.awt.Color getTextBg(){
    return jList1.getBackground();
}
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

dBLogin1.polacz();
node.removeAllChildren();
jTree1.setVisible(false);

if(DBLogin.getManager().connect!=null){
pobierzListe();
jTree1.setVisible(true);
}
    }
private void pobierzListe(){
node.removeAllChildren();
      //jTree1.addTreeSelectionListener(new treeSelection());

node.setUserObject(dBLogin1.getBaza());

jTree1.setVisible(true);
String s[]=DBLogin.getManager().schemas();
for(int i=0;i<s.length;i++)
node.add(new DefaultMutableTreeNode(s[i]));
//DefaultMutableTreeNode x=(DefaultMutableTreeNode)node.getFirstChild();
String[] z,x;
for(int j=0;j<node.getChildCount();j++){
((DefaultMutableTreeNode)node.getChildAt(j)).add(new DefaultMutableTreeNode("tabele"));
((DefaultMutableTreeNode)node.getChildAt(j)).add(new DefaultMutableTreeNode("widoki"));
    z=DBLogin.getManager().tables(dBLogin1.getBaza(),node.getChildAt(j).toString());
    x=DBLogin.getManager().views(dBLogin1.getBaza(),node.getChildAt(j).toString());
 
    for(int i=0;i<z.length;i++){
((DefaultMutableTreeNode)node.getChildAt(j).getChildAt(0)).add(new DefaultMutableTreeNode(z[i]));

}

    for(int i=0;i<x.length;i++)
    ((DefaultMutableTreeNode)node.getChildAt(j).getChildAt(1)).add(new DefaultMutableTreeNode(x[i]));
    
    treemodel.reload();
}

    }//GEN-LAST:event_jButton1ActionPerformed
private void okno(){
     DataFrame rame1=new DataFrame();
   // rame1.setTitle(jList1.getSelectedValue().toString());
try{
 TreePath[] x=jTree1.getSelectionPaths();
 Object[] z =x[x.length-1].getPath();

 //javax.swing.JOptionPane.showMessageDialog(this,z[1].toString());
        rame1.model.setDataVector(dBLogin1.QuerryTable(z[1].toString()+"."+jTree1.getLastSelectedPathComponent().toString()),dBLogin1.ColumnNames(""));
rame1.setTitle(z[1].toString()+"."+jTree1.getLastSelectedPathComponent().toString());
        rame1.show();
        java.sql.ResultSet rs=DBLogin.getManager().dmd.getPrimaryKeys(dBLogin1.getBaza(), z[1].toString(), x[x.length-1].getLastPathComponent().toString());
rs.next();
   //jLabel1.setText(rs.getString(4));  
}catch(java.sql.SQLException e){
    javax.swing.JOptionPane.showMessageDialog(this,e.toString());
}
catch(NullPointerException e){
   javax.swing.JOptionPane.showMessageDialog(this,"Brak połączenia z bazą lub nie zaznaczono elementu z listy");
}
}
    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
try{
        dBLogin1.rozlacz();
node.removeAllChildren();
jTree1.setVisible(false);
node.setUserObject("baza");
jTree1.repaint();
}catch(NullPointerException e){
    System.out.println(e.toString());
}
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton3ActionPerformed

    
    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
new NewTable().show();
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jTree1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree1MouseClicked
try{
        if(evt.getClickCount()==2&&treemodel.getChildCount(jTree1.getLastSelectedPathComponent())==0&&jTree1.getLastSelectedPathComponent()!=null)    // frame2 rame1=new frame2();
   // rame1.setTitle(jList1.getSelectedValue().toString());

       // rame1.model.setDataVector(dBLogin1.QuerryTable(jTree1.getLastSelectedPathComponent().toString()),dBLogin1.ColumnNames(""));
//rame1.setTitle(jTree1.getLastSelectedPathComponent().toString());
      //  rame1.show();
okno();

        if(evt.getButton()==3)
    if(DBLogin.getManager().connect.isClosed()==false){
   jPopupMenu1.show(jTree1, evt.getX(),evt.getY());
    }//jPopupMenu1.show(this, evt.getX(),evt.getY());}


}catch(java.sql.SQLException e){

}
catch(NullPointerException e){
   javax.swing.JOptionPane.showMessageDialog(this,"Brak połączenia z bazą lub nie zaznaczono elementu z listy");
}


        // TODO add your handling code here:
    }//GEN-LAST:event_jTree1MouseClicked

    private void jTree1ValueChanged(javax.swing.event.TreeSelectionEvent evt) {//GEN-FIRST:event_jTree1ValueChanged
//javax.swing.JOptionPane.showMessageDialog(null,jTree1.getLastSelectedPathComponent().toString());
 try{
     jLabel3.setText("");
     jLabel1.setText("");
             jLabel2.setText("");
        TreePath[] x=jTree1.getSelectionPaths();
 Object[] z =x[x.length-1].getPath();

 //javax.swing.JOptionPane.showMessageDialog(this,z[1].toString());
       // dBLogin1.QuerryTable(z[1].toString()+"."+jTree1.getLastSelectedPathComponent().toString()),dBLogin1.ColumnNames(""));
        if(treemodel.getChildCount(jTree1.getLastSelectedPathComponent())==0&&jTree1.getLastSelectedPathComponent()!=null){    // frame2 rame1=new frame2();
jLabel1.setText("Nazwa: "+jTree1.getLastSelectedPathComponent().toString());
jLabel2.setText("Właściciel: "+DBLogin.getManager().tableInfo(dBLogin1.getBaza(),z[1].toString(),z[z.length-1].toString()));

java.sql.ResultSet rs=DBLogin.getManager().dmd.getPrimaryKeys(dBLogin1.getBaza(), z[1].toString(), x[x.length-1].getLastPathComponent().toString());
//pobranie kluczy pierwotnych dla tabeli
rs.next();

   jLabel3.setText("PK: "+rs.getString(4));



   }else jLabel1.setText("");
 }catch(Exception e){
     
 }
 // TODO add your handling code here:
    }//GEN-LAST:event_jTree1ValueChanged

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
pobierzListe();
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked

        if(evt.getButton()==3){
  
   jPopupMenu2.show(this, evt.getX(),evt.getY());
    //.show(this, evt.getX(),evt.getY());
        }

    

        // TODO add your handling code here:
    }//GEN-LAST:event_formMouseClicked

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed

        TreePath[] x=jTree1.getSelectionPaths();
 Object[] z =x[x.length-1].getPath();
 String s=z[1].toString()+"."+x[x.length-1].getLastPathComponent().toString();
 int mm=JOptionPane.showConfirmDialog(jMenuItem1, "Czy na pewno chcesz usunąć obiekt: " +s,"Usuń?",JOptionPane.YES_NO_OPTION);
 if(mm==0){
     if(z[2].toString().equals("tabele"))
     DBLogin.getManager().QueryAsk("drop table "+s+";");
     else if(z[2].toString().equals("widoki")) DBLogin.getManager().QueryAsk("drop view "+s+";");
  pobierzListe();
 }else System.out.print(mm);

 //z[1].toString()+"."+jTree1.getLastSelectedPathComponent().toString()
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
Pomoc p= new Pomoc(null,true);
        p.show();// TODO add your handling code here:
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
    Pomoc p= new Pomoc(null,true);
    p.show();
    // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
if(flaga==false)
    flaga=true;
else flaga=false;
        setLoginVisibile(flaga);
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
new AddSchema().show();
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem5ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
new SQLConsole().show();
        // TODO add your handling code here:
    }                                        

    public void finalize(){
    
        dBLogin1.rozlacz();
}
    
    DefaultMutableTreeNode node= new DefaultMutableTreeNode("baza");
    private javax.swing.tree.DefaultTreeModel treemodel=new javax.swing.tree.DefaultTreeModel(node);
    DefaultMutableTreeNode top = new DefaultMutableTreeNode("Drogi");
    
   /*
    // private DBLogin dBLogin1=new DBLogin();
    // Variables declaration - do not modify//GEN-BEGIN:variables
    DBBrowser.DBLogin dBLogin1;
    javax.swing.JButton jButton1;
    javax.swing.JButton jButton2;
    javax.swing.JButton jButton3;
    javax.swing.JButton jButton4;
    javax.swing.JButton jButton5;
    javax.swing.JButton jButton6;
    javax.swing.JLabel jLabel1;
    javax.swing.JLabel jLabel2;
    javax.swing.JLabel jLabel3;
    javax.swing.JMenu jMenu1;
    javax.swing.JMenuItem jMenuItem1;
    javax.swing.JMenuItem jMenuItem2;
    javax.swing.JMenuItem jMenuItem3;
    javax.swing.JMenuItem jMenuItem4;
    javax.swing.JMenuItem jMenuItem5;
    javax.swing.JMenuItem jMenuItem6;
    javax.swing.JPopupMenu jPopupMenu1;
    javax.swing.JPopupMenu jPopupMenu2;
    javax.swing.JScrollPane jScrollPane2;
    javax.swing.JSeparator jSeparator1;
    javax.swing.JTree jTree1;
    // End of variables declaration//GEN-END:variables
 */
     // Variables declaration - do not modify
    //private ja
    private boolean flaga;
    private javax.swing.JSeparator jSeparator1;
      private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel1;
      private javax.swing.JLabel jLabel2;
    private javax.swing.JMenuItem jMenuItem1;
        private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPopupMenu jPopupMenu1;
     private javax.swing.JPopupMenu jPopupMenu2;
        private javax.swing.JMenuItem jMenuItem3;
          private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JScrollPane jScrollPane2;
     private javax.swing.JTree jTree1;
    private DBLogin dBLogin1;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
        private javax.swing.JButton jButton6;
    private javax.swing.JList jList1;
    private javax.swing.JScrollPane jScrollPane1;
   javax.swing.JMenuItem jMenuItem5;
    javax.swing.JMenuItem jMenuItem6;
javax.swing.JMenu jMenu1;
}
class treeSelection implements  javax.swing.event.TreeSelectionListener {

    treeSelection(){
    super();
}
public void valueChanged(TreeSelectionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}

    

